package top.hzy520.sales.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.hzy520.common.constants.Constants;
import top.hzy520.common.resp.ApiResult;
import top.hzy520.sales.entity.ProductSku;
import top.hzy520.sales.entity.SalesItem;
import top.hzy520.sales.service.SalesService;

import java.util.List;

/**
 * @Author: HouZeYu
 * @Description:
 * @Date: Created in 20:23 2018/6/27
 */
@RestController
@RequestMapping("/sales")
public class SalesController {
    @Autowired
    @Qualifier("salesServiceImpl")
    private SalesService salesService;
    /**
    *@Author: HouZeYu
    *@Description:  查询单个商品参加的活动
    *@Date: 20:26 2018/6/27
    */
    @RequestMapping("/product")
    public ApiResult findProductSkuSales(@RequestBody ProductSku productSku){
        ApiResult<List<SalesItem>> apiResult=new ApiResult(Constants.RESP_STATUS_OK,"查询成功");
         List<SalesItem> salesItemList= salesService.findProductSkuSales(productSku);
         apiResult.setData(salesItemList);
        return apiResult;
    }
}
